/* ****************************************************************************
* Copyright (c) TCC - 2009 IME - USP. 
*
* This source code is subject to terms and conditions of the Microsoft Public License. 
* A copy of the license can be found in http://msdn.microsoft.com/en-us/library/dd228915.aspx. 
* By using this source code in any fashion, you are agreeing to be bound by the terms of the 
* Microsoft Public License.
*
* You must not remove this notice, or any other, from this software.
* ***************************************************************************/

namespace SoundLibrary
{
	internal abstract class Obuffer
	{
		public const int OBUFFERSIZE = 2 * 1152;
		public const int MAXCHANNELS = 2;

        #region Public Methods

        public virtual void  appendSamples(int channel, float[] f)
		{
			for (int i = 0; i < 32; i++)
			{
				append(channel, (short)clip((f[i])));
			}
        }

        #endregion

        #region Private Methods

        private short clip(float sample)
		{
			return ((sample > 32767.0f)?(short)32767:((sample < - 32768.0f)?(short)- 32768:(short) sample));
        }

        #endregion

        #region Abstract Methods

        public abstract void append(int channel, short value_Renamed);   

		public abstract void  write_buffer(int val);
		
        public abstract void  close();
		
        public abstract void  clear_buffer();
		
		public abstract void  set_stop_flag();

        #endregion

    }
}